<?php session_start();

require_once('Fachada.php');
// Incluindo o imgSet.php que seta os valores da sess�o.
require_once ($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/GUI/imgSet.php');
require_once ($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/ClassesBasicas/Privilegio.php');

$priv = $_SESSION['privilegio'];

if($priv != Privilegio::WEBMASTER){
    echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=/Esquina_da_TI/GUI/EfetuarLogin.php'>";
}


$fachada = new Fachada();

if($_SESSION['ultimaAcaoMinhaConta'] != "CADASTROWEBMASTER") {
    unset($_SESSION["menssagemErro"]);
}


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Cadastro de Clientes</title>
        <link href="/Esquina_da_TI/default.css" rel="stylesheet" type="text/css" media="screen" />
        <script src="/Esquina_da_TI/gui/formulario.js" type="text/javascript"></script>
        <script src="/Esquina_da_TI/js/tituloDinamico.js" type="text/javascript"></script>
        <script src="../js/validador.js" type="text/javascript"></script>
        <script type="text/javascript" src="../ajax/funcs.js"></script>
        <script type="text/javascript" src="../js/calendar1.js"></script>

    </head>
   <body onload='nome.focus()'>
        <center>
            <h1>Cadastro de WebMaster</h1>
            <br>
            <form id="cadastrarWebMaster" name="cadastrarWebMaster" method="POST" action="" enctype='multipart/form-data'>
                <table cellspacing="1" cellpadding="1">
                    <tr>
                        <td class="head" colspan="2">Registrar Informação</td>
                    </tr>
                    <tr>
                        <th>Nome*: </th>
                        <td><input type="text" id="nome" name="nome" size="30" onblur="validarNome(nome.value);" /><label id="campo_Nome"/><input type=hidden name=validacaoNome id="validacaoNome" value=0></td>
                    </tr>
                     <tr>
                        <th>Cpf*: </th>
                        <td><input type="text"  id="cpf" name="cpf" size="18" onkeyup="formatarCampoCNPF(this, event)" onblur="validarDados('cpf', document.getElementById('cpf').value);" ><label id="campo_cpf"/><input type="hidden" name="validacaoCpf" id="validacaoCpf" value="0"></td>

                    </tr>
                    <tr>
                        <th>Data de Nascimento:&nbsp;&nbsp;</th>
                        <td>
                            <input type="Text" name="dataNascimento" id="dataNascimento" size="8" readonly>
                            <a href="javascript:cal1.popup();"><img alt="" src="../images/cal.gif" width="16" height="16" border="0" ></a><br>
                        </td>
                    </tr>
                    <tr>
                        <th>Foto:&nbsp;&nbsp;</th>
                        <td><input type="file" id="foto" name="foto" size="15" onblur="comprova_extensao(this.form.foto.value)">&nbsp;<label id="campo_foto"/><input type=hidden name=validacaoFoto id="validacaoFoto" value=1>
                            <br><font size="1">Formatos Permitidos </font><font color="red" size="1">(JPEG,GIF,BMP,TIFF,PNG)</font>
                        </td>

                    </tr>
                    <tr>
                        <th>E-mail*: </th>
                        <td><input type="text" id="email" name="email" size="30" onblur="validarDados('email', document.getElementById('email').value);" /><label id="campo_email"/><input type=hidden name=validacaoEmail id="validacaoEmail" value=0></td>
                    </tr>
                    <tr>
                        <th>Login*:</th>
                        <td ><input type="text" id="loginUsuario" name="loginUsuario" size="20" onblur="validarDados('loginUsuario', document.getElementById('loginUsuario').value);" /><label id="campo_loginUsuario"/><input type=hidden name=validacaoLogin id="validacaoLogin" value=0></td>
                    </tr>

                    <tr>
                        <th>Tipo do WebMaster*:</th>
                        <td>
                            <input type="radio" name="tipoWebMaster" id="tipoWebMaster" value="EDITOR" checked/><b>Editor</b>
                            &nbsp;&nbsp;
                            <input type="radio" name="tipoWebMaster" id="tipoWebMaster" value="MODERADOR" /><b>Moderador</b>
                        </td>
                    </tr>
                   
                     <tr><td colspan="2">&nbsp;</td></tr>
                    <tr><td colspan="2">&nbsp;</td></tr>
                    <tr><td colspan="2" align="center"><font style="font-family:fantasy" color="#0066ff" size="1">* Campo de preenchimento obrigatorio!</font></td></tr>
                    <tr><td colspan="2">&nbsp;</td></tr>
                    <tr><td colspan="2">&nbsp;</td></tr>
                    <tr>
                        <td colspan="2" align="center">
                            <input type="button" id="cadastrar" name="cadastrar" value="Cadastrar WebMaster" onclick="validandoFormularioWebMaster(cadastrarWebMaster, validacaoCpf, validacaoNome, validacaoFoto, validacaoEmail, validacaoLogin);"/>

                        </td>
                    </tr>
                </table>
            </form>
            <script language="JavaScript">
                var cal1 = new calendar1(document.forms['cadastrarWebMaster'].elements['dataNascimento']);
                cal1.year_scroll = true;
                cal1.time_comp = false;
            </script>
        </center>
    </body>
</html>
